//
//  MTPhotoesCell.m
//  ShiShiBang
//
//  Created by 宋宝强 on 16/9/21.
//  Copyright © 2016年 motianjituan. All rights reserved.
//

#import "MTPhotoesCell.h"
#import "MTPhotoItem.h"
#import <UIImageView+WebCache.h>

@interface MTPhotoesCell ()

@property (weak, nonatomic) IBOutlet UIImageView *photoImage;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageViewHeight;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentLableHeight;

@end

@implementation MTPhotoesCell

-(void)awakeFromNib {
 
   
}

-(void)setPhoto:(MTPhotoItem *)photo
{
    _photo = photo;
    
    //图片
    [self.photoImage sd_setImageWithURL:[NSURL URLWithString:photo.small_url] placeholderImage:nil];
//    self.photoImage.bounds = CGRectMake(0, 0, MTScreenW - 10, photo.small_height / photo.small_width * (MTScreenW - 10));
    //文字
    self.titleLable.text = photo.title;
    [self.titleLable sizeToFit];
//     self.imageViewHeight.constant = _photo.small_height / _photo.small_width * (MTScreenW  - 10) / 2;
///      self.imageViewHeight.constant = 90;
//    self.contentLableHeight.constant = self.titleLable.mt_height;
    [self setNeedsUpdateConstraints];
    [self updateConstraints];
}
@end
